package com.zxp.server.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.zxp.server.config.Result;
import com.zxp.server.dto.BlogInfo;
import com.zxp.server.dto.BlogTagInfo;
import com.zxp.server.dto.RespPageBean;
import com.zxp.server.service.IBlogTagService;
import com.zxp.server.vo.BlogTag;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 朱小皮
 * @since 2022-7-10
 */
@Api(value = "专栏管理", tags = "专栏管理")
@RestController
@RequestMapping("/special")
public class SpecialController {

    @Autowired
    private IBlogTagService blogTagService;

    @ApiOperation(value = "获取专栏标签")
    @GetMapping("/getSpecialTag")
    public Result getSpecialTag(){

        List<BlogTagInfo> blogTags = blogTagService.getSpecialTagInfo();
        return Result.success("获取成功",blogTags);
    }

    @ApiOperation(value = "获取专栏博客列表(含高级查询)")
    @GetMapping("/getBlogsByTag")
    public Result getBlogsByTag(@RequestParam(defaultValue = "1") Integer currentPage,
                                @RequestParam(defaultValue = "10") Integer size,Integer tagId){
        RespPageBean blogs =  blogTagService.getSpecialList(currentPage, size, tagId);
        return Result.success("获取博客列表成功",blogs);
    }
}
